<template>
	<view class="content">
		<view class="top">
			<view class="top_tit flexs1">
				<view class="cuIcon-back text-white" @click="onBack"></view>
				<view class="text-white">账单明细</view>
				<view class="cuIcon-back cuIcon-back2"></view>
			</view>
			<view class="text-white padds small">余额（元）</view>
			<view class="text-white padds bigs">{{total}}</view>
		</view>
		<view class="kong"></view>
		<view class="cons">
			<view class="list flexs1" v-for="(item, index) in list" :key="index">
				<view class="list_left">
					<view class="name">{{item.memo}}</view>
					<view class="text-gray small2">{{item.createtime}}</view>
				</view>
				<view class="list_right text-red text-bold" v-if="item.type==1">+{{item.money}}</view>
				<view class="list_right text-red text-bold" v-if="item.type==2">-{{item.money}}</view>
			</view>
		</view>
		<view class="btns text-white text-bold text-center" @click="gotopup">立即充值</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				total:0
			}
		},
		onShow() {
			this.initdata()
		},
		methods: {
			initdata(){
				this.$common.requests('/api/shop/mymoneylist').then(res =>{
					if(res.data.code == 1){
						this.list = res.data.data.list;
						this.total = res.data.data.total;
					}else{
						this.$api.msg(res.data.msg)
					}
				})
			},
			gotopup(){
				uni.navigateTo({
					url:'/pages/topUp/topUp'
				})
			},
			//返回上一级
			onBack(){
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style>
	.content{
		width: 100vw;
		height: 100vh;
	}
	.top{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 26vh;
		background: #14C7CE;
		color: #FFFFFF;
		flex-direction: column;
	}
	.top_tit{
		padding: 70upx 30upx 30upx 30upx;
		font-size: 18px;
	}
	.cuIcon-back{
		font-size: 20px;
	}
	.cuIcon-back2{
		color: #14C7CE;
	}
	.small{
		font-size: 30upx;
	}
	.bigs{
		font-size: 65upx;
	}
	.padds{
		padding: 15upx 80upx;
	}
	.kong{
		height: 26vh;
	}
	.cons{
		padding: 0 30upx;
		height: 60vh;
		overflow-y: scroll;
	}
	.list{
		padding: 25upx 0;
		border-bottom: 1px solid #E5E5E5;
	}
	.small2{
		font-size: 26upx;
		padding-top: 20upx;
	}
	.btns{
		width: 76%;
		padding: 25upx 0;
		background: #14C7CE;
		position: fixed;
		border-radius: 15upx;
		bottom: 60upx;
		left: 12%;
		font-size: 30upx;
	}
</style>
